VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "CompartStructure"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
'***************************************************************************
'  Copyright (C) 2000, Intergraph Corporation.  All rights reserved.
'
'  Project: CompartStructure
'
'  History:
'  AppaRao            31st Mar 2005             Creation
'***************************************************************************
Option Explicit

Private Const MODULE = "CompartStructure: "
Implements IJCustomCompute

Private Sub IJCustomCompute_Evaluate(ByVal pCompartEntity As Object)
    On Error GoTo ErrorHandler
    Const METHOD = "IJCustomCompute_Evaluate"
    
    SetValueToAttribute pCompartEntity
    
    Exit Sub
    
ErrorHandler:
    Err.Raise CompartLogError(Err, MODULE, METHOD)
End Sub

Private Sub SetValueToAttribute(oObj As Object)
On Error GoTo ErrorHandler
Const METHOD = "SetValueToAttribute"

    Dim oAttributeMetadata          As IJDAttributeMetaData
    Dim oAttrHelper                 As IJDAttributes
    Dim oAttributesCollection       As IJDAttributesCol
    Dim oAttribute                  As IJDAttribute
    Dim oInterfaceInfo              As IJDInterfaceInfo
    ' Cache the interface iids
    Set oAttributeMetadata = oObj
    Set oAttrHelper = oObj
    
    Set oInterfaceInfo = oAttributeMetadata.InterfaceInfo(oAttributeMetadata.iid("IJUACompartStructure"))
    
    Set oAttributesCollection = oAttrHelper.CollectionOfAttributes(oInterfaceInfo.Type)
    
    On Error Resume Next
    For Each oAttribute In oAttributesCollection
            Select Case oAttribute.AttributeInfo.Name
            Case "VolumeMoulded"
                oAttribute.Value = GetVolumeMoulded(oObj)
            Case "WallArea"
                oAttribute.Value = GetWallArea(oObj)
            Case "WallLength"
                oAttribute.Value = GetWallLength(oObj)
            Case "DeckHeight"
                oAttribute.Value = GetDeckHeight(oObj)
            Case "SideWallArea"
                oAttribute.Value = GetSideWallArea(oObj)
            Case "BottomArea"
                oAttribute.Value = GetBottomArea(oObj)
            Case "BottomCGX"
                oAttribute.Value = GetBottomCGX(oObj)
            Case "BottomXGY"
                oAttribute.Value = GetBottomXGY(oObj)
            Case "BottomXGZ"
                oAttribute.Value = GetBottomXGZ(oObj)
            End Select
    Next
    On Error GoTo ErrorHandler
    
    Set oAttributeMetadata = Nothing
    Set oAttrHelper = Nothing
    Set oAttributesCollection = Nothing
    Set oAttribute = Nothing
    Set oInterfaceInfo = Nothing

    Exit Sub
    
ErrorHandler:
    Err.Raise CompartLogError(Err, MODULE, METHOD)
End Sub


